#include "ClientSocket.h"

ClientSocket::ClientSocket()
{

}

bool ClientSocket::Open(const std::string& hostname, int port)
{
	SDLNet_ResolveHost(&m_ip, hostname.c_str(), port);

	if (m_ip.host == INADDR_NONE)
	{
		// can't find address
		return false;
	}
	else
	{
		m_socket = SDLNet_TCP_Open(&m_ip);
		if (!m_socket)
		{
			return false;
		}
	}

	return true;
}

void ClientSocket::SetSocket(const TCPsocket& s)
{
	m_socket = s;
}